package com.tyk.bookstore.front.system.service.impl;


import com.tyk.bookstore.front.common.core.util.AssertUtil;
import com.tyk.bookstore.front.system.model.constant.SystemSettingConstant;
import com.tyk.bookstore.front.system.model.result.SystemSettingResultEnum;
import com.tyk.bookstore.front.system.repository.SystemSettingRepository;
import com.tyk.bookstore.front.system.service.SystemSettingApiService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class SystemSettingApiServiceImpl implements SystemSettingApiService {

    private final SystemSettingRepository systemSettingRepository;


    @Override
    public String getOrderSplitMode() {
        String mode = systemSettingRepository.selectSingleValueByName(SystemSettingConstant.ORDER_SPLIT_MODE);
        AssertUtil.notBlank(mode, SystemSettingResultEnum.SETTING_NOT_FOUND);
        return mode;
    }

    @Override
    public String getMemberDefaultAvatar() {
        String mode = systemSettingRepository.selectSingleValueByName(SystemSettingConstant.MEMBER_DEFAULT_AVATAR);
        AssertUtil.notBlank(mode, SystemSettingResultEnum.SETTING_NOT_FOUND);
        return mode;
    }
}
